<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //所要遍历的数据结构：
        let  data = [{
            a: 11,
            b: 22,
            c: {
                a: 11,
                b: 22,
            }
        }]
        findDep(node = [], arr = []) {
            for (let item of node) {
                arr.push({ a: item.a, b: item.b })
                //将c对象存进数组，便于递归遍历
                let parentArr = []
                if (item.c) parentArr.push(item.c)
                if (parentArr && parentArr.length) this.findDep(parentArr, arr)
            }
            console.log('000',arr)
            return arr
            
        }
    </script>
</body>

</html>